<script setup lang="ts">
import {ref,onMounted} from 'vue'
import HmButton from './components/HmButton.vue'

const childRef = ref<InstanceType<typeof HmButton>>()

onMounted(() => {
  console.log(childRef.value);
  console.log(childRef.value?.car);
  
  childRef.value?.logCar()
})
</script>

<template>
  <!-- 1.父组件传递给子组件ref -->
  <div class="app-page">
    父组件
  <HmButton ref="childRef" />
  </div>
</template>

<style lang="css" scoped>
.app-page{
width: 600px;
height: 400px;
background-color: pink;
}
</style>
